﻿using System;
using System.ComponentModel;

namespace QuickDev.Licensing
{
    public class AppLicense : System.ComponentModel.License
    {
        #region Constants

        #endregion

        #region Member Variables

        private string _licenseKey;
        private AppLicenseProvider provider;

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="T:AppLicense"/> class.
        /// </summary>
        /// <param name="provider">provider</param>
        /// <param name="licenseKey">licenseKey</param>
        public AppLicense( AppLicenseProvider provider , string licenseKey )
        {
            this.provider = provider;
            this._licenseKey = licenseKey;
        }

        #endregion

        #region Methods

        #region Public

        /// <summary>
        /// Dispose
        /// </summary>
        public override void Dispose()
        {
            if ( this.provider != null )
            {
                this.provider = null;
                this._licenseKey = string.Empty;
                this._licenseKey = null;
            }
        }

        #endregion

        #endregion

        #region Public Properties

        /// <summary>
        /// LicenseKey
        /// </summary>
        public override string LicenseKey
        {
            get
            {
                return this._licenseKey;
            }
        }

        #endregion
    }
}